<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta HTTP-EQUIV="pragma" CONTENT="no-cache">
    <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <meta HTTP-EQUIV="expires" CONTENT="0">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>权限管理</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/font-awesome.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link href="css/ui.css" rel="stylesheet">
    <link rel="stylesheet" href="css/control.css">
    <style>
        #body {
            width: 100%;
            max-height: 100%;
            overflow-y: scroll;
            overflow-x: hidden;
        }

        .articleImg {
            /* width: 100%; */
            /* height: auto !important; */
            max-width: 100px;
        }

        th,
        td {
            text-align: center;
        }
    </style>
</head>

<body class="gray-bg animated fadeInRight">
    <div id="body">
        <div class="wrapper wrapper-content">
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-content">
                            <h1>权限管理</h1>
                            <h2>暂未开放</h2>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/work/common.js"></script>
    <script src="js/plugins/laydate/laydate.js"></script>
    <script src="js/plugins/layer/layer.min.js"></script>
    <script src="js/plugins/layer/layer.js"></script>
    <!-- 自定义js -->
    <script src="js/content.js"></script>
    <script>
        var pageNum = getStorage("pageNum") || 1;
        var pageSize = getStorage("pageSize") || 20;
        var flag = 0;
        $(document).ready(function () {
            $("#pageSizeInfo").val(pageSize)
            var today = Date.parse(new Date())
            getData();
            function getData() {

               var dataList = [ {
                   "userId": 1,
                   "headImage" : "60",
                   "realName" : "张涵",
                   "nickName" : "涵涵",
                   "roleName" : "管理员",
                   "powerList" : "查看",
                   "lastLoginTime" : "2018-10-11 10:00:00",
                   "registerTime" : "2018-10-11 10:00:00"
               }, {
                   "userId": 2,
                   "headImage" : "60",
                   "realName" : "张涵",
                   "nickName" : "涵涵",
                   "roleName" : "管理员",
                   "powerList" : "查看",
                   "lastLoginTime" : "2018-10-11 10:00:00",
                   "registerTime" : "2018-10-11 10:00:00"
               }, {
                   "userId": 3,
                   "headImage" : "60",
                   "realName" : "李世密",
                   "nickName" : "密密",
                   "roleName" : "普通用户",
                   "powerList" : "查看",
                   "lastLoginTime" : "2018-10-11 10:00:00",
                   "registerTime" : "2018-10-11 10:00:00"
               } ];
                creatList(dataList)

                var pageData = {
                    "pageNum":1,
                    "startRow" : 1,
                    "endRow" : 1,
                    "total" : 3,
                    "pages" : 1,
                }
                createPageInfo(pageData);

            }

            function creatList(data) {
                var tpl = '';
                for (var i = 0; i < data.length; i++) {
                    tpl += '<tr class="viewDb" data-val="' + data[i].userId + '">' +
                        '<td><img src="./img/a1.jpg" class="articleImg previewImg" /></td>' +
                        '<td>' + data[i].realName + '</td>' +
                        '<td>' + data[i].nickName + '</td>' +
                        '<td>' + data[i].roleName + '</td>' +
                        '<td>' + data[i].powerList + '</td>' +
                        '<td>' + data[i].lastLoginTime + '</td>' +
                        '<td>' + data[i].registerTime + '</td>' +
                        '<td>' + '<a class="checkInfo btn btn-info btn-xs">查看详情</a></td>' +
                        '</tr>'
                }
                $("#list").empty().append(tpl);

                $('.checkInfo').click(function () {
                    var id = $(this).parent().parent().attr("data-val");
                    setStorage("memberId", id);
                    window.location.href = "memberMsg.html";
                });


            }

            laydate.render({
                elem: '#registerTime1',
                max: timeStamp2String(today, "ymd"),
                showBottom: false,
                done: function (value) {
                    laydate.render({
                        elem: '#registerTime2',
                        min: value,
                        max: timeStamp2String(today, "ymd"),
                        showBottom: false,
                        show: true
                    });
                }
            });
            laydate.render({
                elem: '#loginTime1',
                max: timeStamp2String(today, "ymd"),
                showBottom: false,
                done: function (value) {
                    laydate.render({
                        elem: '#loginTime2',
                        min: value,
                        max: timeStamp2String(today, "ymd"),
                        showBottom: false,
                        show: true
                    });
                }
            });
            $("#submit").on("click", function () {
                getData()
            });
            $("#trans").click(function () {
                $("#conditions").slideToggle();
            });

            $("#list").on("dblclick", ".viewDb", function () {
                var id = $(this).attr("data-val");
                setStorage("memberId", id);
                window.location.href = "memberMsg.html";
            });
            //创建页码信息
            function createPageInfo(data) {
                $("#startRow").text(data.startRow)
                $("#endRow").text(data.endRow)
                $("#totalPage").text(data.total)
                var temp = '';
                for (var i = 1; i < data.pages + 1; i++) {
                    temp += '<option value="' + i + '">' + i + '</option>'
                }
                $("#pageInfo").html(temp);
                $("#pageInfo").val(data.pageNum);
                $("#pageInfo").change(function () {
                    $("#pageInfor").blur();
                    if (flag == 1) {
                        return
                    };
                    flag = 1
                    pageNum = this.options[this.options.selectedIndex].value
                    setStorage("pageNum", pageNum)
                    getData()
                });
                $("#firstPage").click(function () {
                    if (pageNum != 1) {
                        if (flag == 1) {
                            return
                        };
                        flag = 1
                        pageNum = 1
                        setStorage("pageNum", pageNum)
                        getData()
                    }
                });
                $("#lastPage").click(function () {
                    if (pageNum < data.pages) {
                        if (flag == 1) {
                            return
                        };
                        flag = 1
                        pageNum = data.pages
                        setStorage("pageNum", pageNum)
                        getData()
                    }
                });
                $("#nextPage").click(function () {
                    if (pageNum < data.pages) {
                        if (flag == 1) {
                            return
                        };
                        flag = 1
                        pageNum++
                        setStorage("pageNum", pageNum)
                        getData()
                    }
                });
                $("#previousPage").click(function () {
                    if (pageNum > 1) {
                        if (flag == 1) {
                            return
                        };
                        flag = 1
                        pageNum--
                        setStorage("pageNum", pageNum)
                        getData()
                    }
                })
            }
            $("#pageSizeInfo").change(function () {
                $("#pageSizeInfo").blur()
                if (flag == 1) {
                    return
                };
                flag = 1
                pageSize = this.options[this.options.selectedIndex].value;
                setStorage("pageSize", pageSize)
                // getData()
            });
        });
    </script>
</body>

</html>